﻿<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<link href="css/common.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
		<script type="text/javascript" src="js/openwindow.js"></script>
		<script type="text/javascript" src="js/menu.js"> </script>
		<style type="text/css">
			.png{
				_background: url(image/f.png) no-repeat !important; 
				filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=noscale, src="image/f.png");
				background:none;
			}
		</style>
		<script type="text/javascript">
		function totalUser(){
			$.post("totalUser.action",null,function(data){
					$("#total").html(data);
			});
		}
		
	function reLogin(){
		if(confirm("确定要退出？")){
		window.location.href="loginOut.action";
		}
	}
	function openUserList(){
	var url="onlineUser.action";
	openRightWindow(url,165,470);
}
	
	function loginOut(){
		if(confirm("确定要退出？")){
			window.parent.close();
		}
	}
	var oldId=1;
	function openBBS(id){
	var rightFrame=window.parent.document.getElementById("rightFrame");
			if(oldId!=id){
			$("#mynav"+id).attr("class","nav_on");
			$("#mynav"+oldId).attr("class","nav_off");
		}
		var url="http://10.128.131.92/upload/member.php?mod=logging&action=login&loginsubmit=yes&infloat=yes&lssubmit=yes&username=${sessionScope.userInfo.account}&password=admin&referer=http://10.128.131.92/upload/forum.php";	
			rightFrame.src=url;
		oldId=id;
		var _left_main_frmset = window.parent.document.getElementById("lastFrame");
		_left_main_frmset.cols="0,*";
	}

  	$(function(){
		$.post("getUpMenu.action",null,function(data){
			var menuList=data.menuList;
			var info="";
			for(var i=0;i<menuList.length;i++){
				if(i==0){
					info+="<li><A class=\"nav_on\" id=\"mynav"+menuList[i].id+"\" href=\"javascript:loadMenu("+menuList[i].id+")\"><SPAN>"+menuList[i].name+"</SPAN></A></li>";
				}else{
					if(menuList[i].id==55){
				    info+="<li class=\"menu_line\"></li><li><a href=\"javascript:openBBS("+menuList[i].id+")\"   id=\"mynav"+menuList[i].id+"\"  class=\"nav_off\"><span>"+menuList[i].name+"</span></a></li>";
					}else{
					info+="<li class=\"menu_line\"></li><li><a href=\"javascript:loadMenu("+menuList[i].id+")\"   id=\"mynav"+menuList[i].id+"\"  class=\"nav_off\"><span>"+menuList[i].name+"</span></a></li>";
					}
				}
			}
			$("#nav").html(info);
		},"json");
	});
  	
	function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadimage() { //v3.0
  var d=document; if(d.image){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadimage.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}



function signOff(val)
{
	var date=new Date();
	var time=date.toLocaleString();
	
	if(val=='on')
	{	    
		$.post("signIn.action","",function(data){
		if(data=="amsignin"){
		  alert("上午签到成功！签到时间："+time);

		}else if(data=="reamsignin"){
		  alert("上午已签到");
		}else if(data=="pmsignin"){
		  alert("下午签到成功！签到时间："+time);
		}
		else if(data=="repmsignin"){
		  alert("下午已签到");
		}else if(data=="nightsignin"){
		  alert("晚班签到成功！签到时间："+time);
		}
		else if(data=="renightsignin"){
		  alert("晚班已签到");
		}
		else
		{
			alert("签到失败！可能原因：工作时间未设定");
		}
		});
		
	}else if(val=='off')
	{
			$.post("signOut.action","",function(data){
			if(data=="amsignout"){
		 	 alert("上午签退成功！签退时间："+time);

			}else if(data=="pmsignout"){
			  alert("下午签退成功！签退时间："+time);
			}
			else if(data=="nightsignout"){
			  alert("晚班签退成功！签退时间："+time);
			}else
			{
				alert("签退失败！可能原因：工作时间未设定");
			}
			
		});
	}
}
function updateMenu(id,ths) {
	if (oldId != id) {
		$("#mynav" + id).attr("class", "nav_on");
		$("#mynav" + oldId).attr("class", "nav_off");
	}
	var leftFrame = window.parent.document.getElementById("leftFrame");
	var rightFrame = window.parent.document.getElementById("rightFrame");
	leftFrame.contentWindow.loadMenuById(id);
	var _left_main_frmset = window.parent.document.getElementById("lastFrame");
					if (ths == 'psw') {
						rightFrame.src = "cipherA.action";
					}else if(ths=='book'){
						rightFrame.src = "bookList.action";
					}else if(ths=='file'){
						rightFrame.src = "waitFiel.action";
					}else if(ths=='people'){
						rightFrame.src = "updatebook.action";
					}
			_left_main_frmset.cols = "160,*";
			oldId = id;
}


function openPost(){
		var url="fax.action";
		openWindow(url,screen.width,screen.height);
	}
	setInterval(totalUser,30000);
</script>
	</head>

	<body onload="totalUser();">
		<table width="100%" border="0" cellpadding="0" cellspacing="0"
			background="image/tbg.jpg">
			<tr>
				<td height="75" align="left">
					<img src="image/logo.jpg">
				</td>
				<td align="right">
					<table width="100" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td>
								<a id="password" href="javascript:updateMenu(40,'psw')" 
									onmouseout="MM_swapImgRestore()"
									onmouseover="MM_swapImage('Image93','','image/an2.png',1)"><img
										src="image/an1.gif" name="Image93" width="55" height="45"
										border="0" id="Image93" /> </a>
							</td>
							<td>
								<a href="javascript:updateMenu(40,'book')" 
									onmouseout="MM_swapImgRestore()"
									onmouseover="MM_swapImage('Image94','','image/an6.png',1)"><img
										src="image/an5.gif" name="Image94" width="55" height="45"
										border="0" id="Image94" />
								</a>
							</td>
							<td>
								<a href="javascript:updateMenu(40,'file')" 
									onmouseout="MM_swapImgRestore()"
									onmouseover="MM_swapImage('Image95','','image/an8.png',1)"><img
										src="image/an7.gif" name="Image95" width="55" height="45"
										border="0" id="Image95" />
								</a>
							</td>
							<td>
								<a href="javascript:updateMenu(40,'people')"  onmouseout="MM_swapImgRestore()"
									onmouseover="MM_swapImage('Image96','','image/an13.png',1)"><img
										src="image/an13.gif" name="Image96" width="55" height="45"
										border="0" id="Image96" />
								</a>
							</td>
							<td>
								<a href="search.action"  target="rightFrame"
									onmouseout="MM_swapImgRestore()"
									onmouseover="MM_swapImage('Image97','','image/an12.png',1)"><img
										src="image/an11.gif" name="Image97" width="55" height="45"
										border="0" id="Image97" />
								</a>
							</td>
							<td>
								<a href="javascript:reLogin()" onmouseout="MM_swapImgRestore()"
									onmouseover="MM_swapImage('Image98','','image/an15.png',1)"><img
										src="image/an15.gif" name="Image98" width="55" height="45"
										border="0" id="Image98" />
								</a>
							</td>
							<td>
							<a href="javascript:openUserList()" >
								<div class="png" align="center" style="width: 62px;height: 50px;cursor: pointer;">
									<div >
									<font style="font-size:12px;color:#ffffff;"><br>在线<span id="total">0</span>人</font>
									</div>
								</div>
							</a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<table width="100%" border="0" cellpadding="0" cellspacing="0">
			<tr>
				<td height="36" background="image/nav.png">
					<table width="100%" border="0" cellspacing="0" cellpadding="0">
						<tr>
							<td valign="top"  height="40">
								<table style="width: 150px" border="0" align="left" cellspacing="3" cellpadding="0">
									<tr>
										<td height="40px" style="position: absolute" align="left">
											<span style="margin-left:10px; mafont-size: 12px; color: #fff;line-height: 40px">
												<img   src="image/t1.gif" width="16" height="15" />&nbsp;&nbsp;&nbsp;&nbsp;欢迎您${sessionScope.userInfo.name}！
											</span>
										</td>
									</tr>
								</table>
							</td>
							<td width="100%"  align="right">
								<div id="menu" style="float: right" >
									<ul id="nav">
									</ul>
								</div>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
	</body>
</html>